<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Sitemap extends Admin_Controller {
	
	function __construct()
	{
		parent::__construct();
	}
	
	function index()
	{
		$data = array(
			'pages' => $this->admin->getPages(),
			'articles' => array()
		);
		$articles = $this->admin->getArticles();
		foreach ($articles as $val)
			$data['articles'][$val->tBlog][$val->id] = $val;
		$xml = $this->load->view('admin/sitemap', $data, true);
		// echo rootDir().'sitemap.xml';
		file_put_contents(rootDir().'sitemap.xml', $xml);
		redirect(base_url().'admin');
	}

}?>